package com.ifast.oupei.controller;


import java.util.List;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import com.ifast.common.base.BaseController;
import com.ifast.oupei.domain.OddsDO;
import com.ifast.oupei.service.OddsService;

/**
 * 
 * <pre>
 * 比赛赔率信息表
 * </pre>
 * <small> 2018-04-23 12:22:35 | Aron</small>
 */
@Controller
@RequestMapping("/oupei/odds")
public class OddsController extends BaseController {
	@Autowired
	private OddsService oddsService;
	
	/**
	 * 获取赔率信息
	 * @param id
	 * @param ticketsId
	 * @param model
	 * @return
	 */
	@GetMapping("/odds/{id}/{ticketsId}/{matchDate}")
	@RequiresPermissions("oupei:match:match")
	String edit(@PathVariable("id") Integer id,@PathVariable("ticketsId") Integer ticketsId,@PathVariable("matchDate") String matchDate,Model model){
		List<OddsDO> oddsList = oddsService.getOddsList(id);
		model.addAttribute("oddsList", oddsList);
		model.addAttribute("id", ticketsId);
		model.addAttribute("matchDate", matchDate);
	    return "oupei/odds/odds";
	}
	/**
	 * 获取变赔信息
	 * @param id
	 * @param ticketsId
	 * @param model
	 * @return
	 */
	@GetMapping("/getOddsTrack/{id}/{companyId}/{matchDate}")
	@RequiresPermissions("oupei:match:match")
	String getOddsTrack(@PathVariable("id") Integer id,@PathVariable("companyId") Integer companyId,@PathVariable("matchDate") String matchDate,Model model){
	    model.addAttribute("oddsTrackList", oddsService.getOddsTrack(id, companyId, matchDate));
		return "oupei/odds/getOddsTrack";
	}	
}
